from shoter import Shoter
from OCRdecoder import OCR
import redis
from threading import Lock,Thread
from time import sleep


def run():
    redis_pool = redis.ConnectionPool(host='127.0.0.1', port=6379, max_connections=5, db=3, decode_responses=True)
    st = Shoter(redis_pool,'001122',(50,226,50+115,1008))
    #st = Shoter(redis_pool,'001122',(76,240,76+138,240+687))
    #st = Shoter(redis_pool,'001122',(117,176,117+290,176+430))
    ocr = OCR(redis_pool)
    #ocr.ocrrun()
    #return
    th_ocr = Thread(target=ocr.ocrrun)
    th_ocr.setDaemon(True)
    sleep(3)
    #th_ocr.start()
    for i in range(3):
        st.screenshot()
        
    
if __name__ == '__main__':
    run()